package com.qk.management.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.qk.domain.user.UserDO;
import com.qk.dto.user.UserDTO;
import com.qk.entity.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface UserMapper extends BaseMapper<User> {
    List<UserDO> list(UserDTO userDto);

    void addUser(User user);

    @Select("select * from user where username = #{username}")
    User selectByUsername(String username);

    @Select("select * from user where id = #{id}")
    UserDO getUser(Integer id);

    void updateUser(User user);

    @Select("select * from user")
    List<UserDO> getAllUsers();

    List<UserDO> getUsersByRole(String roleLabel);

    @Select("select * from user where dept_id = #{deptId}")
    List<UserDO> getUsersByDeptId(Integer deptId);

}
